import axios from 'axios';

// 创建带基础配置的 Axios 实例
/*const api = axios.create({
  baseURL: 'http://localhost:3000/api', // 统一后端地址
  withCredentials: true, // 必须携带凭证
  headers: {
    'Content-Type': 'application/json' // 明确指定请求头
  }
});*/
const BASE_URL = 'http://localhost:3000/';
// 登录接口
export const login = (email, password) => {
  return axios.post(`${BASE_URL}api/auth/login`, { email, password });
};

// 注册接口
export const register = (email, password, username) => {
  return axios.post(`${BASE_URL}api/auth/register`, { email, password, username });
};